﻿using System;
using Core.UI;
using Cysharp.Threading.Tasks;
using GCFramework.Singleton;
using UnityEngine.SceneManagement;

namespace Core.Manager
{
    public class GameSceneManager : SingletonMono<GameSceneManager>
    {
        public async UniTask LoadScene(string nextScene, float fadeOutWaitTime = 0.05f)
        {
            await TransitionManager.Ins.EnterTransition(TransitionManager.TransitionEffect.FadeInOut_Scene);
            await SceneManager.LoadSceneAsync(nextScene);
            await UniTask.Delay(TimeSpan.FromSeconds(2f));

            await TransitionManager.Ins.ExitTransition(TransitionManager.TransitionEffect.FadeInOut_Scene, fadeOutWaitTime);
        }
    }
}